package com.xwm93up.basic.lambdatips.Sorted;

import com.xwm93up.basic.lambdatips.Student;

import java.util.Arrays;
import java.util.Comparator;

/**
 * @Description: 与Arrays.sort一起使用
 * @Author: xwm93up
 * @Since: 2022/4/19 14:09
 */
public class ArraysSortDemo {
    public static void main(String[] args) {
        Student ram = new Student("Ram", 18);
        Student shyam = new Student("Shyam", 22);
        Student mohan = new Student("Mohan", 19);

        Student[] stdArray = {ram, shyam, mohan};
        Arrays.sort(stdArray, Comparator.naturalOrder());
        for (Student student : stdArray) {
            System.out.println(student.getName() + " ");
        }
    }
}
